package com.saguitech.sgemeos.ui.activities;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.saguitech.sgemeos.R;
import com.saguitech.sgemeos.business.LoginBusiness;
import com.saguitech.sgemeos.utils.MenuBase;
import com.saguitech.sgemeos.utils.MenuBase.TargetActivity;

public class AboutActivity extends Activity {

	LoginBusiness login;
	Intent it;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.about);
		login = (LoginBusiness) getIntent().getSerializableExtra("login");
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(MenuBase.getLayoutResource(), menu);
		return true;
	}

	@Override
	public boolean onPrepareOptionsMenu(Menu menu) {
		MenuBase.adjustMenu(TargetActivity.ABOUT, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		MenuBase.onItemSelected(AboutActivity.this, item);
		if (MenuBase.isIntentPrepared()) {
			MenuBase.getIntent().putExtra("login", login);
			MenuBase.commitIntent(AboutActivity.this);
		}
		return true;
	}

	public void onLogoClick(View view) {
		Intent browserIntent = null;
		if (view.getId() == R.id.saguitechBt) {
			browserIntent = new Intent(Intent.ACTION_VIEW,
					Uri.parse("http://www.saguitech.com.br"));
		} else if (view.getId() == R.id.twitterBt) {
			browserIntent = new Intent(Intent.ACTION_VIEW,
					Uri.parse("http://www.twitter.com/saguitech"));
		} else if (view.getId() == R.id.facebookBt) {
			browserIntent = new Intent(Intent.ACTION_VIEW,
					Uri.parse("http://www.facebook.com/pages/Saguitech/188892727849335"));
		}
		startActivity(browserIntent);
	}
}
